//入口文件

import React from 'react'
import { HashRouter as Router, Route, Link, Switch } from "react-router-dom";

import About from './About'
import Topics from './Topic'
import Main from './Main'

class Home extends React.Component {
    render() {
        return (
            <Router>
                {/* 一定要给路由加根节点 */}
                <div>
                    <ul>
                        <li>
                            <Link to="/">Home</Link>
                        </li>
                        <li>
                            <Link to="/about">About</Link>
                        </li>
                        <li>
                            <Link to="/topics">Topics</Link>
                        </li>
                    </ul>
                    <hr />
                    {/* <Switch></Switch> switch语法 一旦匹配一个，后面就不执行le */}
                    <Route exact path="/" component={Main} />
                    <Route path="/about" component={About} />
                    <Route path="/topics" component={Topics} />
                    
                </div>
            </Router>
        )
    }
}


export default Home